<template>
	<view>
		<view class="top">
			<view>
				<img class="shezhi" src="./shezhi.png" alt="" />
			</view>
			<view>设备保养</view>
		</view>
		<view class="nav">

			<view :class="[flag == '0' ? 'active' : 'nav-']" @click="reject">待保养</view>
			<view :class="[flag == '1' ? 'active' : 'nav-']" @click="accept">保养中</view>
			<view :class="[flag == '2' ? 'active' : 'nav-']" @click="complete">已完成</view>
		</view>
		<view class="center">
			<view class="center-">
				<view class="item" v-for="(item,index) in list" :key="index">
					<view class="left">
						<text>芯片机器保养</text>
						<text>地址：1车间-10{{item}}设备 </text>
						<text>预定时间：2024/3/30/ 13：00</text>
					</view>
					<view class="right">
						<view v-if="flag == 0" style="background-color: orangered; border-radius: 10px;padding:3px;">
							待保养
						</view>
						<view v-if="flag == 1" style="background-color:coral; border-radius: 10px;padding: 3px;">
							保养中
						</view>
						<view v-if="flag == 2" style="background-color:aqua; border-radius: 10px;padding: 3px;">
							已完成
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [1, 2, 3],
				flag: 0,
				number: [1, 2, 3]
			}
		},
		methods: {
			reject() {
				this.flag = 0
			},
			accept() {
				this.flag = 1
			},
			complete() {
				this.flag = 2
			}
		}
	}
</script>

<style scoped>
	.top {
		background-color: #5479FF;
		height: 40px;
		display: flex;
		flex-direction: row;
		align-items: center;
		color: #fff;
	}

	.shezhi {
		width: 20px;
		height: 20px;
		margin-left: 10px;
		margin-top: 5px;
	}

	.nav {
		display: flex;
		justify-content: space-around;
		margin-top: 10px;
	}

	.nav- {
		width: 60px;
		height: 30px;
		line-height: 30px;
		text-align: center;
		color: #ccc;
	}

	.active {
		width: 60px;
		height: 30px;
		line-height: 30px;
		text-align: center;
		color: skyblue;
	}

	.center {
		width: 100%;
		height: 500px;
		background-color: #efefef;
	}

	.center- {
		width: 100%;
		padding-top: 1px;
		border-radius: 10rpx;
	}

	.item {
		/* width: 95%; */
		padding: 3px;
		display: flex;
		background-color: #fff;
		margin: 20px;
		border-radius: 10px;
		flex-direction: row;
		justify-content: space-around;

	}

	.left {
		display: flex;
		flex-direction: column;

	}

	.right {
		margin-top: 10px;

	}

	.right_red {
		background-color: #f00;
	}

	.right_blue {
		background-color: #00f;
	}
</style>